<!--js date picker-->
<link href="<?php echo base_url(); ?>./css/css_datepicker/jquery.ui.all.css" rel="stylesheet" type="text/css" />  
<script type="text/javascript" src="<?php echo base_url(); ?>jscripts/js_datepicker/jquery-1.7.2.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>jscripts/js_datepicker/jquery.ui.core.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>jscripts/js_datepicker/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>jscripts/js_datepicker/jquery.ui.widget.js"></script>

<!--end js date picker-->
<script language="javascript" type="text/javascript">
    $(function() {
        $( ".datepicker" ).datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'yy:mm:dd' 
        });
    });
           
</script>
<style type="text/css">
    .task1 p{ color: red;font-size: 12px;}
    .task1 span{color:red;}
</style>
<div class="task1">
    <?php
    if ($this->session->userdata('ms_error')) {
        echo message($this->session->userdata('ms_error'), "error");
        $this->session->unset_userdata("ms_error");
    }
    echo form_open('product/add');
    echo '<div class="form-wrapper">';
    echo '<fieldset style="margin: 0 auto;width:auto;height: auto;border: 1px #ccc solid; padding:20px 15px 20px 15px;-moz-border-radius:10px;">';
    echo '<legend align="center"><div class="heading" style="margin: 0 auto;width: 100%;height: auto;border: 0px #ccc solid;text-align: center;font-size: 20px;">Add new product</div></legend>';
    echo '<div style="float: right; border: 0px #ccc solid;">';
    echo anchor('product/manager', img('images/user_images/cancel.png'));
    echo '</div>';
    echo '<table  align="center">';
    echo '<tr>';
    echo '<td valign="top">ProductName<span>*</span>&nbsp;</td>';
    echo '<td>' . form_input(array('id' => 'iduser', 'name' => 'txtpro', 'value' => $this->input->post("txtpro") ? $this->input->post("txtpro") : " ")) . form_error('txtpro') . '</td>';
    echo '<tr><td>';
    echo $this->session->userdata('invalid_product');
    $this->session->unset_userdata('invalid_product');
    echo '</td></tr>';
    echo '</tr>';
    echo '<tr>';
    echo '<td valign="top">ProductPrice<span>*</span>&nbsp;</td>';
    echo '<td>' . form_input(array('name' => 'txtpro_price', 'id' => 'idprice', 'value' => $this->input->post("txtpro_price") ? $this->input->post("txtpro_price") : " ")) . form_error('txtpro_price') . '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td valign="top">ProductQuantity<span>*</span>&nbsp;</td>';
    echo '<td>' . form_input(array('name' => 'txtqauntity', 'value' => $this->input->post("txtqauntity") ? $this->input->post("txtqauntity") : " ")) . form_error('txtqauntity') . '</td>';
    echo '</tr>';
    /*
      echo '<tr>';
      echo '<td valign="top">ProductType &nbsp;</td>';
      echo '<td>';
      $select = '<select name="txt_select">';
      $this->db->select('*');
      $datacat=$this->db->get('tbl_pro_type');
      $select.='<option value="">--please select--</option>';
      foreach ($datacat->result() as $rows){
      $select .= '<option value="'.$rows->pro_type_id.'">'.$rows->pro_type_name.'</option>';
      }
      $select .= '</select>';
      echo $select;
      echo form_error('txt_select');
      echo '</td>';
      echo '</tr>';
     */
    echo '<tr>';
    $this->db->select('*');
    $selectdata = $this->db->get('tbl_pro_type');
    $select[' '] = '--Select student--';
    foreach ($selectdata->result() as $row) {
        $select[$row->pro_type_id] = $row->pro_type_name;
    }
    echo '<td>Product Type<span>*</span></td>';
    echo '<td>';
    echo form_dropdown("txt_select", $select, $this->input->post("txt_select") ? $this->input->post("txt_select") : " ");
    echo '</td>';
    echo '</tr>';
    /* =======================end add product type=============== */
    echo '<tr>';
    echo '<td>Detail <span>*</span>&nbsp;</td>';
//echo '<td>'.form_textarea(array('name'=>'txtdetail','value'=>'', 'size' => '30',)).form_error('txtdetail').'</td>';
    echo '<td> ' . form_textarea(array('name' => 'txtdetail', 'rows' => '8', 'cols' => '50')) . form_error('txtdetail') . '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td></td>';
    echo '<td>' . form_submit('btn_submit', 'Add') . form_reset('btn_reset', 'Reset') . '</td>';
//echo '<td>'.form_submit('btn_Cancel','Cancel').'</td>';
    echo '</tr>';
    echo '</table>';
    echo '<p>Note : (*) must be insert!<p>';
    echo '</fieldset>';
    echo '</div>';
    echo form_close();
    ?>
</div>